<?php
    $proid= @isset($_GET['proid']) ? @$_GET['proid'] : '';
    $proinfo= $bb->findprobyid($proid);
	//var_dump($proid);


?>

<style>
    .long{ width: 300px;}
	.short{ width: 150px;}
</style>

<script>
function upimg1(num){
	var num1 = num; 
            // alert(num1);

	$("#imgupload1").load(
	        "imgnum.php",
			 { "imgnum1": num1,  }  
	    )


	
	}

function upimg2(num){

	var num2 = num;
	
	$("#imgupload2").load(
	        "imgnum.php",
			 { "imgnum2": num2,  }  
	    )
	
	}








$().ready(function() {
	
	$("#ads").click(function(){
		var shang99 = $("#s1").val(); alert(shang99);
		
		});


var techgg = document.getElementById("techgg").innerHTML; 
if(techgg != ''){ 
    document.getElementsByTagName("textarea").item(0).innerHTML = techgg;
}


//添加或者修改商品   不必使用ajax技术
/*$("#r2addpro").click(function(){ 
	var r2d0 = $("#r2proid").val(); //alert(r2d0);
	var r2d1 = $("#r2proname").val(); //alert(r2d1);
	var r2d2 = document.getElementById("r2class").options[document.getElementById("r2class").selectedIndex].value; //alert(r2d2);
	
	var r2d3 = $("#r2intro").val(); //alert(r2d3);
	var r2d4 = $("#r2price").val(); //alert(r2d4);
	var r2d5 = $("#r2showorder").val(); //alert(r2d5);
	
	var r2d6 = $("#r2hot").is(":checked") ? 1 : '' ; //alert(r2d6);
	
	var r2d7 = '颜色#';
	var num = $("#r2ex01").children().length; 
	for(var i = 0; i<num; i=i+2){
	    if( $("#r2ex01").children().eq(i).is(":checked") ){
			r2d7+=$("#r2ex01").children().eq(i).val()+'^';
			}
	  }
	//alert(r2d7);
    var r2d8 = $("#r2ex02").val(); //alert(r2d8);
	var r2d9 = $("#r2tech").val(); //alert(r2d9);
	

	
	});   */











	
	
	
});
</script>



<div style=" padding: 20px;">
<form action="addpro.php" method="post" enctype="multipart/form-data">
<p>商品名称<input type="text" id="r2proname" name="r2proname" class="long" value="<?php echo $proinfo['name'] ?>" placeholder="请输入商品名称">
  <input type="text" id="r2proid" name="r2proid" style=" display: none;" value="<?php echo $proinfo['id'] ?>"></p>

<p>所属种类

    <select id="r2class" name="r2class"> 
        <option value="">请选择商品所属种类</option>
         <?php
		        //循环输出商品类
		    $query1 = "select * from product_class where id > 1 ";
			$result1 = $aa->excu($query1);
			while ($pro_class = mysqli_fetch_array($result1, MYSQLI_ASSOC))	{	

		?>
        <option value="<?php echo $pro_class['id'] ?>" <?php if($proinfo['class_id'] == $pro_class['id']){ ?> selected <?php } ?>><?php echo $pro_class['class_name'] ?></option>
        <?php } ?> 
    </select>

</p>

<p>商品简介<input type="text" id="r2intro" name="r2intro" class="long" value="<?php echo $proinfo['intro'] ?>" placeholder="请输入商品简介"></p>
<p>商品价格<input type="text" id="r2price" name="r2price" class="short" value="<?php echo $proinfo['price'] ?>" placeholder="请输入商品价格"></p>
<p>展示顺序<input type="text" id="r2showorder" name="r2showorder" class="short" value="<?php echo $proinfo['show_order'] ?>" placeholder="请输入商品展示顺序"></p>
<p>是否加入首页<input id="r2hot" name="r2hot" type="checkbox" <?php if($proinfo['hot'] == 1) echo "checked"; ?> ></p>

<p>商品选项一（颜色）
    

   <p id="r2ex01"><input type="checkbox" name="check[]" value="img/colred.png" <?php if(  stripos( $proinfo['ex01'], "colred") > -1 ) echo "checked"; ?> ><img src="../img/colred.png" style=" width: 15px; height: 15px; border: 2px solid #CCC;" />
   <input type="checkbox" name="check[]" value="img/colblack.png" <?php if(  stripos( $proinfo['ex01'], "colblack") > -1 ) echo "checked"; ?>  ><img src="../img/colblack.png" style=" width: 15px; height: 15px; border: 2px solid #CCC;" />
   <input type="checkbox" name="check[]" value="img/colwhite.png" <?php if(  stripos( $proinfo['ex01'], "colwhite") > -1 ) echo "checked"; ?>  ><img src="../img/colwhite.png" style=" width: 15px; height: 15px; border: 2px solid #CCC;" />
   </p>

</p>

<p>商品选项二<input type="text" id="r2ex02" name="r2ex02" class="long" value="<?php echo $proinfo['ex02'] ?>" placeholder="请输入第二个商品选项"><span><small>格式如：接口#3.5 mm^type-C</small></span></p>

<p>上传商品展示图片
    <p>图片数量<input id="imgpronum" name="imgpronum" class="short" onChange="upimg1(this.value)" type="text" value="<?php //echo $num1; ?>" placeholder="请输入图片数量1"></p>
    <p id="imgupload1"></p>
<p style=" height: 30px;"></p>

<p>上传商品详细介绍图片
    <p>图片数量<input id="imgproinfonum" name="imgproinfonum" class="short" onChange="upimg2(this.value)" type="text" value="<?php //echo $num2; ?>" placeholder="请输入图片数量2"></p>
    <p id="imgupload2"></p>
    
    
<p>商品技术规格</p>
    <p><textarea id="r2tech" name="r2tech" rows="10" cols="50" placeholder="书写格式如： 产品名称^线控耳机#单元直径（mm）^14.2#驱动功率^动圈(CCAW)"></textarea></p>
    <p id="techgg" style=" display: none;"><?php echo $proinfo['tech'] ?></p>
    
<p style=" text-align: center;">

<input type="submit" id="r2addpro" value="<?php if($proid == ''){ ?>添加<?php }else{?> 修改 <?php } ?>" ></p>


</p> 
    
</form>


<p id="tjres"></p>



</div>

<script>

</script>